
#ifndef TILEMANAGER_H
#define TILEMANAGER_H
#include "Tile.h" 
#include <map>
#include "Draw.h"
#include<algorithm>   
#include <stack>
class TileManager{
public:
	 //static method that takes a drawable and ints and sets that drawables image to the tileset image.
	
	static const int GUI_HEIGHT = 200;
	static const int SCREEN_BPP = 32;
	static const int TILE_SIZE = 32; 
	static const int NUM_TILES_X = 38;//SCREEN_WIDTH/TILE_SIZE;
	static const int NUM_TILES_Y = 22;//SCREEN_HEIGHT/TILE_SIZE;
	static const int SCREEN_HEIGHT = TILE_SIZE*NUM_TILES_Y+GUI_HEIGHT;//make sure these are divisible by TILE_SIZE
	static const int SCREEN_WIDTH = TILE_SIZE*NUM_TILES_X; 
	static const int NUM_IMAGES = 900;
	static const int TILESET_WIDTH = 30;//number of tiles wide the tileset is

	static const int NUM_TILES = NUM_TILES_X*NUM_TILES_Y;
	Tile * tileArray[NUM_TILES_X][NUM_TILES_Y]; 
	SDL_Rect images[NUM_IMAGES];
	static SDL_Surface * screen ;
    SDL_Surface * tileset ;
	static void giveDrawableImage(SDL_Surface * thing, int index); //this functionality would make mmore sense inside the drawable class. However, the tileset is passed into the manager for now.
	void spawn( Drawable* thing, int x, int y);
	bool move( Drawable* thing, int spaces, char* direction);
	static int getIndex(int x, int y, bool isInScreenCoordinatesAndNotInTileCoordinates = 0);
	int printTileCoords(int x , int y);
	Tile* getTile(int x, int y); 
	//	static TileManager * instance; //singleton class
	void update(); //draws every tile in the collection to the screen
	void createShroud() const;
	static TileManager * getInstance(SDL_Surface * result, SDL_Surface * screen);
	void setTileImage(Tile* tile, int imgID);
	void applyFloor(Drawable* floor );//takes a single floor object and puts it into each tile's drawables container. does not duplicate the object
	//private:
	TileManager( SDL_Surface * set, SDL_Surface * screen);



};

#endif